﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

using Stanza.Silverlight.Controls;
using Stanza.Silverlight.Media;

namespace Demo
{
    public partial class ColorPickerDemo : AutoSizeUserControl
    {
        public ColorPickerDemo()
        {
            InitializeComponent();

            showFullScreen.Click += delegate( object sender, RoutedEventArgs e ) {
                Application.Current.Host.Content.IsFullScreen = !Application.Current.Host.Content.IsFullScreen;
            };

            startColorPicker.SelectedColorChanged += new SelectedColorChangedHandler( ColorPicker_SelectedColorChanged );
            endColorPicker.SelectedColorChanged += new SelectedColorChangedHandler( ColorPicker_SelectedColorChanged );
            borderColorPicker.SelectedColorChanged += delegate( object sender, SelectedColorChangedArgs e ) {
                demoRect.Stroke = new SolidColorBrush( e.SelectedColor );
            };
        }

        void ColorPicker_SelectedColorChanged( object sender, SelectedColorChangedArgs e )
        {
            LinearGradientBrush b = new LinearGradientBrush { StartPoint = new Point( 0.5, 0 ), EndPoint = new Point( 0.5, 1 ) };
            b.GradientStops.Add( new GradientStop { Color = startColorPicker.SelectedColor } );
            b.GradientStops.Add( new GradientStop { Color = endColorPicker.SelectedColor, Offset = 1 } );
            demoRect.Fill = b;
        }
    }
}
